import time

from selenium.webdriver.common.by import By

from Base import Base
from Page import Page


class Page1(Page):
    loc_username=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')
    def username(self):
        self.send_keys(self.loc_username,'hzy')
    loc_password=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')
    def password(self):
        self.send_keys(self.loc_password,'123')
    loc_login=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]')
    def login(self):
        self.click(self.loc_login)
    loc_que=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]/span')
    def que(self):
        self.click(self.loc_que)
    loc_add=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/form/div[2]/div[3]/div/div/button')
    def add(self):
        self.click(self.loc_add)
    loc_fen=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[1]/div/div/div/input')
    def fen(self):
        self.send_keys(self.loc_fen,'移动通信')
    loc_miao=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[2]/div/div/div/input')
    def miao(self):
        self.send_keys(self.loc_miao,'这是移动通信分类')
    loc_id=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[3]/div/div/div/input')
    def id(self):
        self.send_keys(self.loc_id,'3')
    loc_ti=(By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[4]/div/button[1]')
    def ti(self):
        self.click(self.loc_ti)




    def luoji_add(self):
        self.open_url('http://localhost:8080/yklogin3')
        self.username()
        self.password()
        self.login()
        self.que()
        time.sleep(2)
        self.add()
        self.fen()
        self.miao()
        self.id()
        self.ti()
